<!doctype html>
<html lang="en-US">
<head>
    <meta charset="UTF-8">
    <title></title>
</head>
<body>
<script type="text/javascript">

    window.addEventListener('onbeforeunload',function(){
        return "test onbeforeunload";
    },false);
    window.addEventListener('onbeforeunload',function(){
        return "test onbeforeunload 2";
    },false);
    window.onunload = function(){
        console.log('test.......................');
        //confirm("test onunload");
        return "test onunload";
    }

</script>


</body>
</html>